package com.powernode.controller;

import com.powernode.domain.Category;
import com.powernode.model.Result;
import com.powernode.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author 梁卓
 * @Version 1.0
 * @ClassName CategoryController
 * @Description 商品类目管理
 * @Date 2024/07/28 21:46
 */
@Api("商品类目接口管理")
@RequestMapping("/prod/category")
@RestController
public class CategoryController {

    @Resource
    private CategoryService categoryService;

    /**
     *  查询商品所有类目
     * @return 类目列表
     */
    @ApiOperation("查询商品所有类目")
    @GetMapping("table")
    @PreAuthorize("hasAuthority('prod:category:page')")
    public Result<List<Category>> loadCategoryList() {
        return Result.success(categoryService.queryAllCategorxyList());
    }
}
